package cn.bugstack.springframework.beans;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: yulong
 * @date: 2021/8/11
 */
public class PropertyValues {

    private final List<PropertyValue> propertyValueList = new ArrayList<>();

    public void addPropertyValue(PropertyValue pv) {
        this.propertyValueList.add(pv);
    }

    public PropertyValue[] getPropertyValues() {
        return this.propertyValueList.toArray(new PropertyValue[0]);
    }

    public PropertyValue getPropertyValue(String propertyName) {
        return propertyValueList.stream().filter(i -> i.getName().equals(propertyName)).findFirst().orElse(null);
    }

}
